
/**
 * Project Name:cats-web
 * File Name:MessageController.java
 * Package Name:com.catsic.web.controllers
 * Date:2014年4月3日上午9:03:56
 * Copyright (c) 2014, oa.catsic.com All Rights Reserved.
 */
 
package com.catsic.pub.controllers;


import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.catsic.base.controller.BaseController;
import com.catsic.pub.condition.MessageCondition;
import com.catsic.pub.entity.Message;
import com.catsic.pub.message.service.MessageService;

/**
 * ClassName: MessageController
 * Description: 系统消息Controller
 * date: 2014年4月3日 上午9:03:56
 * author: yangyd
 */
@Controller
@RequestMapping("/message")
public class MessageController extends BaseController{
	
	@Autowired
	private MessageService messageService;
	
	/**
	 * update:编辑
	 * @author yangyd
	 * @param message
	 * @return
	 */
	@RequestMapping(value = "/update" , method = RequestMethod.POST)
	@ResponseBody
	public Map<String,Object> update(String id){
		messageService.update(id);
		Map<String,Object> map = new HashMap<String,Object>();
		map.put(RESULT, RESULT_SUCCESS);
		return map;
	}
	
    /**
     * 查询用户
	 * @author yangyd
	 * @param condition 
	 * @return
	 */
	@RequestMapping(value = "/query" , method = RequestMethod.GET)
	@ResponseBody
	public Map<String,Object> query(MessageCondition condition,Pageable  pageable){
		Page<Message> page = messageService.findAll(condition, pageable);
		Map<String,Object> map = new HashMap<String,Object>();
		map.put(CONTENT, page);
		map.put(RESULT, RESULT_SUCCESS);
		return map;
	}
}
